﻿ALTER TABLE [dbo].[DeviceDom]
    ADD CONSTRAINT [FK_DeviceDom_Device] FOREIGN KEY ([RootDeviceId]) REFERENCES [dbo].[Device] ([Id]) ON DELETE SET NULL ON UPDATE CASCADE;

